﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Supplier/SupplierMasterPage.master"
    AutoEventWireup="true" CodeFile="Vehicles.aspx.cs" Inherits="Supplier_Location_Vehicles" %>

<asp:Content ID="Content2" ContentPlaceHolderID="pnlMain" runat="Server">
    <table cellpadding="0" cellspacing="0">
        <col width="100" />
        <tr>
            <td colspan="2">
                <asp:Literal ID="ltrMessage" runat="server"></asp:Literal>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <h3>Add New Vehicle</h3>
            </td>
        </tr>
        <tr id="trSupplier" runat="server">
            <td>
                Supplier
            </td>
            <td>
                <asp:Literal ID="ltrSupplier" runat="server"></asp:Literal>
            </td>
        </tr>
        <tr>
            <td>
                Location
            </td>
            <td>
                <asp:Literal ID="ltrLocation" runat="server"></asp:Literal>
            </td>
        </tr>
        <tr>
            <td>
                Vehicle
            </td>
            <td>
                <asp:DropDownList ID="ddlSupplierVehicleAdd" runat="server">
                </asp:DropDownList>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="*"
                    ValidationGroup="VGEDIT" ControlToValidate="ddlSupplierVehicleAdd" Display="Dynamic"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td>
                On Request
            </td>
            <td>
                <asp:CheckBox ID="chkOnRequestAdd" runat="server" />
            </td>
        </tr>
        <tr>
            <td>
                Insurance Price
            </td>
            <td>
                <asp:TextBox ID="txtInsurancePriceAdd" runat="server" MaxLength="5" Width="100"></asp:TextBox><asp:RequiredFieldValidator
                    ID="RequiredFieldValidator1Add" ControlToValidate="txtInsurancePriceAdd" ValidationGroup="VGADD"
                    runat="server" ErrorMessage="*" Display="Dynamic"></asp:RequiredFieldValidator><asp:RegularExpressionValidator
                        ID="RegularExpressionValidator1Add" runat="server" ErrorMessage="Invalid Value"
                        ControlToValidate="txtInsurancePriceAdd" ValidationGroup="VGADD" ValidationExpression="\d{1,2}(?:\.\d{1,2})?$"
                        Display="Dynamic"></asp:RegularExpressionValidator>
            </td>
        </tr>
        <tr>
            <td>
                Isurance Sell Price
            </td>
            <td>
                <asp:TextBox ID="txtInsuranceSellPriceAdd" runat="server" MaxLength="5" Width="100"></asp:TextBox><asp:RequiredFieldValidator
                    ID="RequiredFieldValidator1SellPriceAdd" ControlToValidate="txtInsuranceSellPriceAdd"
                    ValidationGroup="VGADD" runat="server" ErrorMessage="*" Display="Dynamic"></asp:RequiredFieldValidator><asp:RegularExpressionValidator
                        ID="RegularExpressionValidator1SellPriceAdd" runat="server" ErrorMessage="Invalid Value"
                        ControlToValidate="txtInsuranceSellPriceAdd" ValidationGroup="VGADD" ValidationExpression="\d{1,2}(?:\.\d{1,2})?$"
                        Display="Dynamic"></asp:RegularExpressionValidator>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:Button ID="btnAdd" runat="server" Text="Add" ValidationGroup="VGADD" OnClick="btnAdd_Click" />
            </td>
        </tr>
        <tr>
            <td colspan="2">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:GridView ID="gvVehicles" runat="server" AutoGenerateColumns="False" EmptyDataText="No Record Found"
                    DataKeyNames="SupplierLocationVehicleId" OnRowDataBound="gvVehicles_RowDataBound"
                    OnRowCommand="gvVehicles_RowCommand" OnRowCancelingEdit="gvVehicles_RowCancelingEdit"
                    OnRowDeleted="gvVehicles_RowDeleted" 
                    OnRowDeleting="gvVehicles_RowDeleting" OnRowEditing="gvVehicles_RowEditing"
                    OnRowUpdated="gvVehicles_RowUpdated" 
                    OnRowUpdating="gvVehicles_RowUpdating">
                    <Columns>
                        <asp:TemplateField HeaderText="Vehicle">
                            <EditItemTemplate>
                                <asp:DropDownList ID="ddlSupplierVehicleEdit" runat="server">
                                </asp:DropDownList>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="*"
                                    ValidationGroup="VGEDIT" ControlToValidate="ddlSupplierVehicleEdit" Display="Dynamic"></asp:RequiredFieldValidator>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblVehicleName" runat="server"></asp:Label>
                            </ItemTemplate>
                            <FooterTemplate>
                            </FooterTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="On Request" ItemStyle-HorizontalAlign="Center">
                            <EditItemTemplate>
                                <asp:CheckBox ID="chkOnRequestEdit" runat="server" />
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblOnRequest" runat="server"></asp:Label>
                            </ItemTemplate>
                            <FooterTemplate>
                            </FooterTemplate>

<ItemStyle HorizontalAlign="Center"></ItemStyle>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Insurance Price">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtInsurancePriceEdit" runat="server" MaxLength="5" Width="100"></asp:TextBox><asp:RequiredFieldValidator
                                    ID="RequiredFieldValidator1" ControlToValidate="txtInsurancePriceEdit" ValidationGroup="VGEDIT"
                                    runat="server" ErrorMessage="*" Display="Dynamic"></asp:RequiredFieldValidator><asp:RegularExpressionValidator
                                        ID="RegularExpressionValidator1" runat="server" ErrorMessage="Invalid Value"
                                        ControlToValidate="txtInsurancePriceEdit" ValidationGroup="VGEDIT" ValidationExpression="\d{1,2}(?:\.\d{1,2})?$"
                                        Display="Dynamic"></asp:RegularExpressionValidator>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblInsurancePrice" runat="server"></asp:Label>
                            </ItemTemplate>
                            <FooterTemplate>
                            </FooterTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Insurance Sell Price">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtInsuranceSellPriceEdit" runat="server" MaxLength="5" Width="100"></asp:TextBox><asp:RequiredFieldValidator
                                    ID="RequiredFieldValidator1SellPriceEdit" ControlToValidate="txtInsuranceSellPriceEdit"
                                    ValidationGroup="VGEDIT" runat="server" ErrorMessage="*" Display="Dynamic"></asp:RequiredFieldValidator><asp:RegularExpressionValidator
                                        ID="RegularExpressionValidator1SellPriceEdit" runat="server" ErrorMessage="Invalid Value"
                                        ControlToValidate="txtInsuranceSellPriceEdit" ValidationGroup="VGEDIT" ValidationExpression="\d{1,2}(?:\.\d{1,2})?$"
                                        Display="Dynamic"></asp:RegularExpressionValidator>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblInsuranceSellPrice" runat="server"></asp:Label>
                            </ItemTemplate>
                            <FooterTemplate>
                            </FooterTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:LinkButton ID="lnkEdit" CausesValidation="false" CommandName="Edit" runat="server"
                                    Text="Edit"></asp:LinkButton>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:LinkButton ID="lnkSave" CausesValidation="true" runat="server" CommandName="Update"
                                    ValidationGroup="VGEDIT" Text="Update"></asp:LinkButton>
                                &nbsp
                                <asp:LinkButton ID="lnkCancel" CausesValidation="false" runat="server" CommandName="Cancel"
                                    Text="Cancel"></asp:LinkButton>
                            </EditItemTemplate>
                            <FooterTemplate>
                                <asp:LinkButton ID="lnkAdd" CausesValidation="true" runat="server" CommandName="ADD"
                                    ValidationGroup="VGADD" Text="Add"></asp:LinkButton>
                            </FooterTemplate>
                        </asp:TemplateField>
                        <asp:CommandField ShowDeleteButton="True" />
                    </Columns>
                </asp:GridView>
            </td>
        </tr>
    </table>
</asp:Content>
